import cv2
import matplotlib.pyplot as plt
import numpy as np

if __name__ == '__main__':
    img = cv2.imread('police_story.png')
    img1 = plt.imread('police_story.png')
    if img is not None:
        # plt.imshow(img1)
        # plt.show()
        face = np.random.randint(0, 255, (430, 517, 3))
        img[175:605, 275:792, :] = face
        cv2.namedWindow("data", cv2.WINDOW_NORMAL)  # 创建一个可调整大小的窗口
        cv2.resizeWindow("data", 400, 400)  # 正确调用 resizeWindow
        cv2.imshow("data", img)

        cv2.waitKey(0)  # 等待用户按键
        cv2.destroyAllWindows()
    else:
        print("Error: Image not found. Please check the file path.")
